<html>

<head>
  <title>JUHUSLIKKUSE MUSTER</title>

  <link href="style.css" rel="stylesheet" type="text/css">
</head>

<?php
require "ab.inc.php";

	   $sqlcmd="select*from mustrid order by id";
       $result=mysql_query($sqlcmd);

       $m=array();

       while($myrow = mysql_fetch_array($result))
       {
           if  ($myrow["kuvamine"]==1)
            {
                array_push($m, $myrow["pilt"]);
            }

       }

$random = array_rand($m);
$pilt11 = $m[$random];
mysql_close();

require "ab.inc.php";

	   $sqlcmd="select*from mustrid order by id";
       $result=mysql_query($sqlcmd);

       $m=array();

       while($myrow = mysql_fetch_array($result))
       {
           if  ($myrow["kuvamine"]==1 & $myrow["pilt"] != $pilt11)
            {
                array_push($m, $myrow["pilt"]);
            }

       }

$random = array_rand($m);
$pilt22 = $m[$random];
mysql_close();


echo"<body background=imgs/".$pilt11.">

<table width=900 height=900 align=center valign=middle>
<tr>

<td background=imgs/".$pilt22." align=center valign=middle>

<table width=400 height=400 align=center valign=middle>
<tr>

<td bgcolor=#ffffff align=center valign=middle class=kiri>";

$i=$_GET['i'];

require "fn.inc.php";
require "ab.inc.php";

$sqlcmd="select*from mustrid order by id";
$result=mysql_query($sqlcmd);


 while($myrow = mysql_fetch_array($result))
 {

 	if (($myrow["id"])==$i)
 		{
         	$iide=$i;
         	$id=$myrow["id"];

         	$pilt=$myrow["pilt"];

         	$kuvamine=$myrow["kuvamine"];


echo"<form enctype=\"multipart/form-data\" name=\"ankeet\" action=\"muuda_pilt_c.php\" method=\"post\" onsubmit='return kontroll()'>

<img src=\"imgs/".$pilt."\" border=\"1\" valign=\"top\"><br /><br />";

echo $pilt."<br /><br />";

echo"Uus pilt<br />

<input type=\"file\" name=\"pilt_uus\" value=\"$pilt_uus\" size=\"40\"><br /><br />

Kuvamine ";
echo kuvamise_valik("kuvamine",$kuvamine);

echo"<br /><br />
<input type=\"hidden\" name=\"iide\" value=\"$iide\">
<input type=\"hidden\" name=\"pilt\" value=\"$pilt\">

<input type=\"submit\" value=\" Muuda &raquo;\" onClick=\"return check_submit();\"></form>";

  		}
 }
mysql_close();

?>
<br />
<a href="muuda_pilt_a.php">Nimekirja juurde</a><br />
<a href="index.php">Algusesse</a>

</td>

</tr>
</table>

</td>

</tr>
</table>


</body>

</html>